home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / LIBRARY / VTOOLS / VTFAST.ASM < prev    next >
Assembly Source File  |  1995-02-20  |  5KB  |  141 lines

  1.                 .286
  2. DATA    SEGMENT BYTE PUBLIC
  3.  
  4.  
  5.         EXTRN     VSeg : WORD
  6.         EXTRN     Voff : WORD
  7.         EXTRN   VPageL : WORD
  8.  
  9. DATA    ENDS
  10.  
  11.  
  12. CODE    SEGMENT BYTE PUBLIC
  13.  
  14.         ASSUME  CS:CODE,DS:DATA
  15.  
  16.     Public PlainWrite
  17.  
  18.       PlainWrite Proc Far
  19.           enter 0,0                 ; New stack frame
  20.          push ds es                 ; Save old DS ES
  21.          mov ax,[bp+12d]            ; Load Screen coordinates
  22.          mov bx,[bp+10d]            ;  -"-
  23.          dec al                     ; Compute to std coordinates
  24.          dec bl                     ;
  25.          shl bx,7                   ; Compute offset of Active Video Page
  26.          mov di,bx
  27.          shr di,2
  28.          add di,bx
  29.          shl ax,1
  30.          add di,ax
  31.          add di,VOff
  32.          mov es,VSeg
  33.          mov ds,[bp+08d]              ; Load String addres
  34.          mov si,[bp+06d]              ; Load String offset
  35.          lodsb                       ; Get string length to AX
  36.          cmp al,0                    ; If 0 ?
  37.          je EndPlain                 ; then EXIT
  38.          mov cx,ax                   ; load length to cx
  39.   WriteNextPlain:
  40.          movsb                       ; Type letter to screen
  41.          dec cx
  42.          cmp cx,0                    ;Finish String ?
  43.          je EndPlain                 ;If yes then return
  44.          inc di                      ;Disable to write attributes
  45.          Jmp WriteNextPlain          ;WriteNextCharacter
  46. EndPlain:
  47.          pop es ds                   ; Restore old ES, DS
  48.           leave                      ; Leave procedure
  49.          retf 8d
  50.     PlainWrite EndP
  51.  
  52. ;=======================================
  53.  
  54.     Public ColorWrite
  55.       ColorWrite Proc Far
  56.           enter 0,0                 ; New stack frame
  57.          push ds es                 ; Save old DS ES
  58.          Push si di
  59.          mov ax,[bp+16d]            ; Load Screen coordinates
  60.          mov bx,[bp+14d]            ;  -"-
  61.          dec al                     ; Compute to std coordinates
  62.          dec bl                     ;
  63.          shl bx,8                   ; Compute offset of Active Video Page
  64.          shr bx,1
  65.          mov di,bx
  66.          shr di,2
  67.          add di,bx
  68.          shl ax,1
  69.          add di,ax
  70.          add di,VOff
  71.          mov es,VSeg
  72.          mov ax,[bp+12d]             ; Load Foreground
  73.          mov bx,[bp+10d]             ; -"-  BackGround
  74.          shl bx,4                    ; Compute Attributes
  75.          add bx,ax                   ; BackG * 16 + ForeG
  76.          mov ds,[bp+08]              ; Load String addres
  77.          mov si,[bp+06]              ; Load String offset
  78.          lodsb                       ; Get string length to AX
  79.          cmp al,0                    ; If 0 ?
  80.          je EndColor                 ; then EXIT
  81.          mov cx,ax                   ; load length to cx
  82. WriteNextColor:
  83.          movsb                       ; Type letter to screen
  84.          mov al,bl                   ; Store attributes in AL
  85.          stosb                       ; Write attributes to Screen
  86.          dec cx
  87.          cmp cx,0                    ;Finish String ?
  88.          je EndColor                 ;If yes then return
  89.          Jmp WriteNextColor          ;WriteNextCharacter
  90. EndColor:
  91.          pop di si
  92.          pop es ds                   ; Restore old ES, DS
  93.           leave                      ; Leave procedure
  94.          retf 12d
  95.     ColorWrite EndP
  96.  
  97. ;========================
  98.  Public SetCharAttr
  99.  SetCharAttr proc Far
  100.          Enter 0,0                  ; New Stack Frame
  101.          mov ax,[bp+10d]            ; Load Screen coordinates
  102.          mov bx,[bp+08d]            ;  -"-
  103.          dec al                     ; Compute to std coordinates
  104.          dec bl                     ;
  105.          shl bx,8                   ; Compute offset of Active Video Page
  106.          shr bx,1
  107.          mov di,bx
  108.          shr di,2
  109.          add di,bx
  110.          shl ax,1
  111.          add di,ax
  112.          add di,VOff
  113.          inc di                      ; increment offset to position to Attributes
  114.          mov es,VSeg
  115.          mov ax,[bp+6d]              ; Load Attributes;
  116.          stosb                       ; Set attributes
  117.          Leave                       ; Leave Procedure
  118.          retf 6d
  119.  SetCharAttr endp
  120.  
  121.  Public cls
  122.  cls proc far
  123.     enter 0,0
  124.      push ds es
  125.       mov es,VSeg
  126.       mov di,Voff
  127.       mov cx,VPageL
  128.       mov ax,[bp+6]
  129.       Mov ah,32d
  130.       rol ax,8
  131.       rep stosw
  132.       pop es ds
  133.       leave
  134.       ret 2
  135.  cls endp
  136.  
  137.  
  138. CODE    ENDS
  139.  
  140.         END
  141.